home *** CD-ROM | disk | FTP | other *** search
- #ifndef V320200.H
- #define V320200.H
-
-
- /****************************************/
- /* V320200.H */
- /* (C) Copyright 1993 David Bollinger */
- /* send comments to CIS ID# 72510,3623 */
- /* compiled with Borland C++ 3.0 */
- /* pre-calculated tables for stars.c */
- /* (save time & code, waste data space) */
- /****************************************/
-
- #include <bios.h>
- #include <stdlib.h>
- #include <time.h>
- #include "v320200.h"
-
- #define TRUE (0==0)
- #define FALSE (0==1)
- #define AND &&
- #define OR ||
- #define NOT !
- #define MAXX 320 // screen x dimension
- #define MAXY 200 // screen y dimension
- #define CENTERX 160 // center x coord of screen
- #define CENTERY 100 // center y coord of screen
-
- /***********************/
- /* function prototypes */
- /***********************/
- void SetVideoMode(int mode);
- void PutPixel(int x, int y, int c);
- void SetupPalette(void);
-
-
- /* screen memory row offsets */
- unsigned int ytable[200] =
- {0u,320u,640u,960u,1280u,1600u,1920u,2240u,2560u,2880u,3200u,3520u,3840u,
- 4160u,4480u,4800u,5120u,5440u,5760u,6080u,6400u,6720u,7040u,7360u,7680u,
- 8000u,8320u,8640u,8960u,9280u,9600u,9920u,10240u,10560u,10880u,11200u,11520u,
- 11840u,12160u,12480u,12800u,13120u,13440u,13760u,14080u,14400u,14720u,15040u,
- 15360u,15680u,16000u,16320u,16640u,16960u,17280u,17600u,17920u,18240u,18560u,
- 18880u,19200u,19520u,19840u,20160u,20480u,20800u,21120u,21440u,21760u,22080u,
- 22400u,22720u,23040u,23360u,23680u,24000u,24320u,24640u,24960u,25280u,25600u,
- 25920u,26240u,26560u,26880u,27200u,27520u,27840u,28160u,28480u,28800u,29120u,
- 29440u,29760u,30080u,30400u,30720u,31040u,31360u,31680u,32000u,32320u,32640u,
- 32960u,33280u,33600u,33920u,34240u,34560u,34880u,35200u,35520u,35840u,36160u,
- 36480u,36800u,37120u,37440u,37760u,38080u,38400u,38720u,39040u,39360u,39680u,
- 40000u,40320u,40640u,40960u,41280u,41600u,41920u,42240u,42560u,42880u,43200u,
- 43520u,43840u,44160u,44480u,44800u,45120u,45440u,45760u,46080u,46400u,46720u,
- 47040u,47360u,47680u,48000u,48320u,48640u,48960u,49280u,49600u,49920u,50240u,
- 50560u,50880u,51200u,51520u,51840u,52160u,52480u,52800u,53120u,53440u,53760u,
- 54080u,54400u,54720u,55040u,55360u,55680u,56000u,56320u,56640u,56960u,57280u,
- 57600u,57920u,58240u,58560u,58880u,59200u,59520u,59840u,60160u,60480u,60800u,
- 61120u,61440u,61760u,62080u,62400u,62720u,63040u,63360u,63680u};
-
- /* 32 color greyscale palette */
- unsigned char palette[32*3] =
- {0,0,0,2,2,2,4,4,4,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,16,16,16,18,18,18,
- 20,20,20,22,22,22,24,24,24,26,26,26,28,28,28,30,30,30,32,32,32,34,34,34,
- 36,36,36,38,38,38,40,40,40,42,42,42,44,44,44,46,46,46,48,48,48,50,50,50,
- 52,52,52,54,54,54,56,56,56,58,58,58,60,60,60,62,62,62};
-
- unsigned char norm_palette[32*3] =
- {0,0,0 ,255,0,0 ,0,255,0 ,0,0,255 ,255,255,0 ,0,255,255 ,255,0,255
- ,50,50,50 ,90,90,90 ,10,20,30 ,90,50,10 ,100,45,87 ,80,12,200 ,12,100,200
- ,46,47,48 ,49,50,51 ,52,53,54 ,55,56,57 ,58,59,60 ,61,62,63 ,64,65,66
- ,67,68,69 ,70,71,72 ,73,74,75 ,76,77,78 ,79,80,81 ,82,83,84 ,85,86,87
- ,88,89,90 ,91,92,93 ,94,95,96 ,22,23,24};
-
-
- /***************************************************************************/
- /* BIOS call to set video mode recomended 19 */
- /*******************************/
- void SetVideoMode(int mode)
- {
- asm mov ah, 0
- asm mov al, byte ptr mode
- asm int 10h
- }
-
- /***************************************************************************/
- /* direct video access to screen to plot a single pixel */
- /* destroys ax, bx, es */
- /********************************************************/
- void PutPixel(int x, int y, int c)
- {
- asm mov ax, 0xa000
- asm mov es, ax
- asm mov bx, word ptr y
- asm shl bx, 1
- asm mov ax, word ptr ytable[bx]
- asm add ax, word ptr x
- asm mov bx, ax
- asm mov ax, word ptr c
- asm mov byte ptr es:[bx], al
- }
-
- /***************************************************************************/
- /* make a nice greyscale palette */
- /* destroys ax, bx, cx, dx, es */
- /*********************************/
- void SetupPalette(void)
- {
- asm mov ax, SEG norm_palette // get segment of palette
- asm mov es, ax
- asm mov dx, OFFSET norm_palette // get offset of palette
- asm mov bx, 0 // start with color # 0
- asm mov cx, 32 // load 32 colors
- asm mov ax, 0x1012 // bios function 10 subfunction 12
- asm int 0x10 // call bios to load palette
- }
-
- /***************************************************************************/
-
- #endif
-